import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Border here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Border extends Actor
{
    /**
     * Act - do whatever the Border wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    
    private int sum = 0;
    
    public void act() 
    {
        if (getX() == 0 ||getX() == 779) 
        {
            if(sum == 2)
            {
                getWorld().removeObject(this);
            }
        }
        sum++;
    }  
}
